export default function useVoice() {
  const innerAudioContext = wx.createInnerAudioContext()

  // innerAudioContext.onError((res) => {
  //   console.error('🚀 -- innerAudioContext.onError -- res.errMsg', res.errMsg)
  //   console.error('🚀 -- innerAudioContext.onError -- res.errCode', res.errCode)
  // })

  function playVoice(src: string) {
    innerAudioContext.src = src
    innerAudioContext.play()
  }
  function stopVoice() {
    innerAudioContext.stop()
  }
  return {
    playVoice,
    stopVoice,
  }
}
